package cn.jia.hrm;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * ES的课程对象
 * @Document :标记该类是一个ES的文档对象
 */
@Document(indexName = "hrm",type = "course")
@Data
public class CourseDoc {

    /**
     * @Id:该字段的值作为Document 的ID
     */
    @Id
    private Long id;

    /**
     * 名字
     */
    @Field(type =FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String name;

    /**
     * 等级名字 ：青铜，白银
     */
    @Field(index = true,type =FieldType.Keyword)
    private String gradeName;

    @Field(index = true,type =FieldType.Keyword)
    private String forUser;

    @Field(index = true,type =FieldType.Long)
    private Long courseTypeId;

    @Field(index = true,type =FieldType.Keyword)
    private String tenantName;

    @Field(index = false,type =FieldType.Keyword)
    private String pic;

    @Field(index = false,type =FieldType.Integer)
    private Integer saleCount;

    @Field(index = false,type =FieldType.Integer)
    private Integer viewCount;

    @Field(index = false,type =FieldType.Integer)
    private Integer commentCount;

    //收费规则：，收费1免费，2收费
    @Field(index = true,type =FieldType.Keyword)
    private String chargeName;

    @Field(type =FieldType.Float)
    private Float price;

    @Field(type =FieldType.Float)
    private Float priceOld;

    @Field(type =FieldType.Date)
    private Date onlineTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGradeName() {
        return gradeName;
    }

    public void setGradeName(String gradeName) {
        this.gradeName = gradeName;
    }

    public String getForUser() {
        return forUser;
    }

    public void setForUser(String forUser) {
        this.forUser = forUser;
    }

    public Long getCourseTypeId() {
        return courseTypeId;
    }

    public void setCourseTypeId(Long courseTypeId) {
        this.courseTypeId = courseTypeId;
    }

    public String getTenantName() {
        return tenantName;
    }

    public void setTenantName(String tenantName) {
        this.tenantName = tenantName;
    }

    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    public Integer getSaleCount() {
        return saleCount;
    }

    public void setSaleCount(Integer saleCount) {
        this.saleCount = saleCount;
    }

    public Integer getViewCount() {
        return viewCount;
    }

    public void setViewCount(Integer viewCount) {
        this.viewCount = viewCount;
    }

    public Integer getCommentCount() {
        return commentCount;
    }

    public void setCommentCount(Integer commentCount) {
        this.commentCount = commentCount;
    }

    public String getChargeName() {
        return chargeName;
    }

    public void setChargeName(String chargeName) {
        this.chargeName = chargeName;
    }

    public Float getPrice() {
        return price;
    }

    public void setPrice(Float price) {
        this.price = price;
    }

    public Float getPriceOld() {
        return priceOld;
    }

    public void setPriceOld(Float priceOld) {
        this.priceOld = priceOld;
    }

    public Date getOnlineTime() {
        return onlineTime;
    }

    public void setOnlineTime(Date onlineTime) {
        this.onlineTime = onlineTime;
    }

    @Override
    public String toString() {
        return "CourseDoc{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", gradeName='" + gradeName + '\'' +
                ", forUser='" + forUser + '\'' +
                ", courseTypeId=" + courseTypeId +
                ", tenantName='" + tenantName + '\'' +
                ", pic='" + pic + '\'' +
                ", saleCount=" + saleCount +
                ", viewCount=" + viewCount +
                ", commentCount=" + commentCount +
                ", chargeName='" + chargeName + '\'' +
                ", price=" + price +
                ", priceOld=" + priceOld +
                ", onlineTime=" + onlineTime +
                '}';
    }
}
